import { http } from "../http";

const baseUrl = "/api/terminalResource";

export interface TerminalResourceType {
  id: string;
  areaName: string;
  name: string;
  signalStatus: number;
  previewUrl?: string;
  createTime: string;
}
export interface GetTerminalResourceListQueryType {
  areaName?: string | null;
  name?: string | null;
  currentPage?: number | null;
  numPerPage?: number | null;
}

export interface GetTerminalResourceListResponseType {
  list: TerminalResourceType[];
  currentPage: number;
  numPerPage: number;
  totalCount: number;
}

export interface AddOrUpdateTerminalResourceQueryType {
  id?: string;
  areaName: string;
  name: string;
  signalStatus: number;
  previewUrl?: string;
}

export interface GetTerminalResourceDetailQueryType {
  terminalResourceId: string | null;
}

// 获取终端资源列表
export const getTerminalResourceListAPI = (
  params: GetTerminalResourceListQueryType
) => {
  return http.post(`${baseUrl}/getTerminalResourceList`, params);
};

// 添加或更新终端资源
export const addOrUpdateTerminalResourceAPI = (
  params: AddOrUpdateTerminalResourceQueryType
) => {
  return http.post(`${baseUrl}/addOrUpdateTerminalResource`, params);
};

// 获取终端资源详情
export const getTerminalResourceDetailAPI = (
  params: GetTerminalResourceDetailQueryType
) => {
  return http.post(`${baseUrl}/getTerminalResourceDetail`, params);
};
